const request = ( date = {}, url = 'https://wn.wdyky.com/index/wx/getmids', type = 'POST', header = {
}) => {
    return new Promise((resolve, reject) => {
        uni.request({
            method: type,
            url: url,
            data: date,
            header: header,
            dataType: 'json',
			
        }).then((response) => {
            let [error, res] = response;
			// 请求成功的回调函数

			if(res.data.code == 401){
				
				// uni.navigateTo({
				// 	url: '/pages/index/login'
				// });
				
				window.location.href = 'https://wn.wdyky.com/index/index/login?type=web';

			}else if(res.data.code == 1){
				console.log('返回正确回调')
				localStorage.setItem("mid",res.data.mid)
				resolve(res.data);
			}
        }).catch(error => {
           
        })
    });
}
export default request